package com.zy.annota;

import java.lang.reflect.Field;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/12/8 16:51
 **/
public class Test {
    @MyAnnotation(value = "google")
    public void eat() {
        //通过反射，取得 @MyTiger注解的 value值
        try {
            MyAnnotation anno = Test.class.getMethod("eat").getAnnotation(MyAnnotation.class);
            System.out.println(anno.value());
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("我想吃包子");
    }


    public static void main(String[] args) throws NoSuchFieldException {

       Test t = new Test();
       t.eat();


        }

    }


//}
